<template>
	<view  style="display: flex;margin:0 auto;flex-direction: column; width: 749rpx;font-size: 28rpx;">
		<view  @click="qingchuall"
			style="display: flex;background-color: blue;color: white;align-items: center;justify-content: center;border-radius: 15rpx;width:230rpx;height: 50rpx;margin-left: 450rpx;">
			清除所有数据
		</view>
		<view style="display: flex;flex-direction: row;align-items: center;width: 80%;margin: 10rpx auto;">
			<text style="color: blue;font-weight: 600;">电话：</text>
			<uni-easyinput :focus="telfocus" type="number" v-model="tel" placeholder="请输入家长联系方式" @blur="chaxuntel" />
		</view>
		<view style="display: flex;flex-direction: row;align-items: center;width: 80%;margin: 10rpx auto;">
			<text style="color: blue;font-weight: 600;">姓名：</text>
			<uni-easyinput type="text" v-model="name" placeholder="请输入学生姓名" @blur="loadinfo" />
		</view>
		<view style="display: flex;flex-direction: row;align-items: center;width: 80%;margin: 10rpx auto;">
			<text style="color: blue;font-weight: 600;">年龄：</text>
			<uni-easyinput type="number" v-model="age" placeholder="请输入学生年龄" @blur="loadinfo" />
		</view>
		<view v-if="!ip==1"
			style="display: flex;flex-direction: row;align-items: center;width: 80%;margin: 10rpx auto;">
			<text style="color: blue;font-weight: 600;">校区：</text>
			
			<picker @change="xiaoquxuanze" :range="xiaoqulist" style="width: 80%;">
				<!-- <uni-easyinput type="text" disabled v-model="xiaoqu" placeholder="请选择校区" suffixIcon="bottom" /> -->
				<view style="display: flex;height: 70rpx;align-items: center;">
					<view class="">
						<uni-easyinput type="text" v-model="xiaoqu" disabled placeholder="请选择校区" @blur="loadinfo" />
					</view>
					<view class="">
						<uni-icons style="font-size:38rpx;margin-right:10rpx;margin-left: 30rpx;" type="bottom"></uni-icons>
					</view>
				</view>
			</picker>
		</view>
		<view v-if="!ip==1" style="display: flex;flex-direction: row;align-items: center;width: 80%;margin: 10rpx auto;">
			<text style="color: blue;font-weight: 600;">课程：</text>
			<view style="display: flex;align-items: center;">
				<uni-easyinput style="width: 420rpx;" type="text" v-model="kecheng" placeholder="请输入课程关键词"  />
				<picker @change="bindPickerChange"  :range="kechenglistName">
					<uni-icons @click="kechengfun" style="font-size: 40rpx;margin-left:20rpx;" type="bottom"></uni-icons>
				</picker>
			</view>
		</view>
		<view style="display: flex;flex-direction: row;align-items: center;width: 80%;margin: 10rpx auto;">
			<text style="color: blue;font-weight: 600;">住址：</text>
			<uni-easyinput type="text" v-model="zhuzhi" placeholder="请输入学生住址" @blur="loadinfo" />
		</view>
		<view style="display: flex;flex-direction: row;align-items: center;width: 80%;margin: 10rpx auto;">
			<text style="color: blue;font-weight: 600;">就读学校：</text>
			<uni-easyinput type="text" v-model="school" placeholder="请输入学生就读学校" @blur="loadinfo" />
		</view>
		<view style="display: flex;flex-direction: row;align-items: center;width: 80%;margin: 10rpx auto;">
			<text style="color: blue;font-weight: 600;">就读年级：</text>
			<uni-easyinput type="text" v-model="nianji" placeholder="请输入学生就读学校" @blur="loadinfo" />
		</view>
		<view style="display: flex;flex-direction: row;align-items: center;width: 80%;margin: 10rpx auto;">
			<text style="color: blue;font-weight: 600;">报名日期：</text>
			<picker mode="date" :value="baomingdate" :start="startDate" :end="endDate" @change="bindDateChange">
				<uni-easyinput type="text" v-model="baomingdate" placeholder="请输入报名日期" @blur="loadinfo" />
			</picker>
		</view>
		<view style="display: flex;flex-direction: row;align-items: center;width: 80%;margin: 10rpx auto;">
			<text style="color: blue;font-weight: 600;">截止日期：</text>
			<picker mode="date" :value="jiezhidate" :start="startDate" :end="endDate" @change="bindDateChange1">
				<uni-easyinput type="text" v-model="jiezhidate" placeholder="请输入报名日期" @blur="loadinfo" />
			</picker>
		</view>
		<view v-if="!ip==1"
			style="display: flex;flex-direction: row;align-items: center;width: 80%;margin: 10rpx auto;">
			<text style="color: blue;font-weight: 600;">报名费用：</text>
			<uni-easyinput type="number" v-model="money1" placeholder="请输入报名所交费用" @blur="loadinfo" />
		</view>
		<view v-if="!ip==1"
			style="display: flex;flex-direction: row;align-items: center;width: 80%;margin: 10rpx auto;">
			<text style="color: blue;font-weight: 600;">收费方式：</text>
			<uni-easyinput type="text" v-model="shoufeifangshi" placeholder="请输入收费的方式" @blur="loadinfo" />
		</view>
		<view v-if="!ip==1"
			style="display: flex;flex-direction: row;align-items: center;width: 80%;margin: 10rpx auto;">
			<text style="color: blue;font-weight: 600;">课程数量：</text>
			<uni-easyinput type="number" v-model="kechengshu" placeholder="请输入报名课程的数量" @blur="loadinfo" />
		</view>
		<view  style="display: flex;flex-direction: row;align-items: center;width: 80%;margin: 10rpx auto;">
			<text style="color: blue;font-weight: 600;">已核销数量：</text>
			<uni-easyinput type="number" v-model="yihexiaoshu" placeholder="请输入已上课程数量" @blur="loadinfo" />
		</view>
		<view style="display: flex;flex-direction: row;align-items: center;width: 80%;margin: 10rpx auto;">
			<text style="color: blue;font-weight: 600;">备注：</text>
			<uni-easyinput type="textarea" v-model="beizhu" placeholder="备注信息" @blur="loadinfo" />
		</view>
		<!-- <view v-if="shu1" style="display: flex; width: 300rpx;height: 300rpx;margin: 20rpx auto;">
			<image style="width: 300rpx;height: 300rpx;" :src="shu1" mode=" aspectFill"></image>
			<uni-icons @click="delpic1(shu1)" style="margin-left: -50rpx;z-index: 100;" type="close"
				size="50rpx"></uni-icons>
		</view> -->
		<!-- <view v-if="!shu1" style="display: flex;width: 100px;justify-content: center;margin: 10rpx auto;">
			<uni-file-picker limit="1" :del-icon="true" :imageStyles="imageStyles" file-mediatype="image"
				@success="fanhuiurl" @delete="delpic">照片上传</uni-file-picker>
		</view> -->
		<view @click="tijiao"
			style="display: flex;background-color: blue;width: 40%; border-radius: 20rpx;margin: 60rpx auto;color: white;justify-content: center;align-items: center;padding: 20rpx 0;">
			{{shu}}
		</view>
		<view @click="delbaoke()" v-if="ip==1 && meiyi_userinfo.permission.indexOf('del_baokelist') != -1" style="display: flex;justify-content: center;">
			删除本学生报课的信息！
		</view>
	</view>
</template>

<script>
	import getDateTime from '@/common/getdateTime.js';
	export default {
		data() {
			const currentDate = this.getDate({
				format: true
			})
			return {
				iskecheng:'',//判断kecheng为选择的，而不是输入的
				telfocus: true, //电话输入框是否自动获取焦点
				// iszhaopian: 0, //记录照片是否上传完成，0为未完成，1为完成。
				// shu1: '', //承载照片，决定相关元素是否显示
				detail: '', //修改明细记录
				shu: '提交',//用来标识按键是提交还是修改
				shu2: 0, //用来判断手机号已存在，不能提交
				ip: '', //判断修改还是新增
				// imageStyles: {
				// 	width: 100,
				// 	height: 100,
				// 	border: {
				// 		color: "blue",
				// 		width: 2,
				// 		style: 'dashed',
				// 		radius: '12px'
				// 	}
				// },
				name: '',
				age: null,
				zhuzhi: '',
				kecheng: '',
				beizhu:'',
				nianji: '',
				school: '',
				tel: '',
				baomingdate: '',
				jiezhidate: '',
				kechengshu: null,
				yihexiaoshu: null,
				money1: null,
				shoufeifangshi: '',
				kecheng: '',
				zhaopian: '',
				kechenglist: [], //从数据库中获取课程的LIST
				kechenglistName:[],
				xiaoqu: '',
				xiaoqulist: [], //从数据库中获取校区LIST
				infor: [], //获取要修改学生的信息
				kechengid: ''
			}
		},
		async onLoad(options) {
			this.meiyi_userinfo=await uniCloud.getCurrentUserInfo()
			let meiyi_name_tel=await uni.getStorageSync('meiyi_name_tel')
			this.jingshouren=meiyi_name_tel.name+meiyi_name_tel.mobile
			// 下面是修改的时候获取修改学员信息
			this.infor = await uni.getStorageSync('aoyashenginfor')
			this.ip = options.ip
			this.jiance()
			this.xiaoquname()
			var timeStr = getDateTime.dateTimeStr('y-m-d h:i:s'); // y:年 m:月 d:日 h:时 i:分 s:秒 中间的分割符号可更改
			this.baomingdate = this.ip?this.infor.baomingdate: timeStr
		},
		computed: {
			startDate() {
				return this.getDate('start');
			},
			endDate() {
				return this.getDate('end');
			}
		},
		methods: {
			// 课程的数据库调取
			kechengfun() {
				let arr=[]
				this.kechenglist=[]
				this.kechenglistName=[]
				arr.push(this.xiaoqu)
				uniCloud.callFunction({
					name:"funshare",
					data:{
						leixing:27,//类型为27时，获取本校区的课程
						xiaoqu:arr,
						key:this.kecheng
					}
				}).then(res=>{
					this.kechenglist=res.result.data
					res.result.data.map(item => {
						this.kechenglistName.push(item.name)
					})
				})
			},
			// 删除本条报课信息
			delbaoke() {
				//查看一下续费状态,有续费的不能删除
				if(this.infor.isxufei==1){
					uni.showToast({
						title: '存在续费记录，本课程不能删除！',
						icon: 'none',
						duration: 1000
					})
					return
				}else 
				//查看一下是否有销课记录,如有，则本课程不能被删除
				if(this.infor.xiaokeshu){
					uni.showToast({
						title: '存在销课记录，本课程不能删除！',
						icon: 'none',
						duration: 1000
					})
					return
				}
				//增加提示信息，确认是否可以删除
				uni.showModal({
					title: '重要提示，删除报课记录：',
					content: '再次确认，一定要删除吗？再次确认，一定要删除吗？再次确认，一定要删除吗？再次确认，一定要删除吗？再次确认，一定要删除吗？再次确认，一定要删除吗？',
					showCancel: true,
					cancelText: '取消',
					confirmText: '确定',
					success: res => {
						//点确认执行删除过程
						if (res.confirm) {
							//如果本课程有xufeifrom字段，把上级报课记录中isxufei改为0
							if (this.infor.hasOwnProperty('xufeifrom')) {
							    uniCloud.callFunction({
							    	name: "delpic",
							    	data: {
							    		leixing: 11, //类型为8时，删除指定课程
							    		id: this.infor.xufeifrom
							    	}
							    }).then(res => {
							    })
							}
							//删除本报课记录，增加一条修改记录，增加一条zhangwuliushui
							uniCloud.callFunction({
								name: "delpic",
								data: {
									leixing: 10, //类型为8时，删除指定课程
									id: this.infor._id,
									jine: this.infor.money1,
									detail: '删除' + this.infor.id[0].name + this.infor.id[0].mobile +
										'所报课程' + this.infor.kecheng,
									riqi:getDateTime.dateTimeStr('y-m-d h:i:s'),
									jingshouren:this.jingshouren,
									xiaoqu:this.infor.xiaoqu
										
								}
							}).then(res => {
								uni.navigateTo({
									url: '/pages/xueshenginfor/xueshenginfor'
								});
								uni.showToast({
									title: '删除成功！',
									icon: 'none',
									duration: 1000
								})
							})

						}
					},
					fail: () => {},
					complete: () => {}
				});

			},
			// 清除所有数据
			qingchuall() {
				uni.removeStorageSync('aoyashengxueshenginfo')
				this.$router.go(0)
			},
			//加载输入学生的信息
			loadinfo() {
				if(!this.ip==1){
					uni.setStorageSync('aoyashengxueshenginfo', {
						tel: this.tel,
						name: this.name,
						age: this.age,
						zhuzhi: this.zhuzhi,
						school: this.school,
						nianji: this.nianji,
						money1: this.money1,
						shoufeifangshi: this.shoufeifangshi,
						kechengshu: parseInt(this.kechengshu),
						kecheng:this.kecheng,
						xiaoqu:this.xiaoqu,
						yihexiaoshu: this.yihexiaoshu,
						jiezhidate:this.jiezhidate,
						beizhu:this.beizhu
					})
				}
			},
			//查询手机号是否在userinfo中存在，如果存在提示到报新课或续费界面，
			chaxuntel() {
				this.telfocus = false
				// 检查手机号是否正确
				let myreg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
				if (!myreg.test(this.tel)) {
					this.telfocus = true
					return uni.showToast({
						title: '请输入正确的手机号',
						icon: 'none',
						mask: true
					})
				}
				uniCloud.callFunction({
					name: "funshare",
					data: {
						leixing: 14,
						tel: this.tel
					}
				}).then(res => {
					if (this.ip == 1) {
						if (this.tel !== this.infor.id[0].mobile) {
							if (res.result.data.length) {
								this.shu2 = 1, //用来阻止提交新生报名信息
									//跳转到报新课或者续费界面
									uni.showToast({
										title: '手机号码已存在，不能改为已存在的号码',
										icon: 'none',
										mask: true
									})
								return
							} else {
								this.shu2 = 0
							}
						}
					} else {
						if (res.result.data.length) {
							let that=this
							this.shu2 = 1, //用来阻止提交新生报名信息
								//跳转到报新课或者续费界面
								uni.showModal({
									title: '本号码已存在！',
									content: '本号码在系统中已存在，请选择给该生报新课程还是续费！',
									cancelText: '报新课',
									confirmText: "续费",
									icon: 'none',
									success: function(res) {
										if (res.confirm) {
											uni.navigateTo({
												url: '/pages/xueshenginfor/xueshenginfor?tel='+that.tel
											});
										} else if (res.cancel) {
											uni.navigateTo({
												url: '/pages/baoxinke/baoxinke?tel='+that.tel
											});
										}
									}
								})
						} else {
							this.shu2 = 0
						}
					}
				})
			},
			
			//调出校区，并去重
			xiaoquname(){
				const res=uni.getStorageSync("aoyashengxiaoqu")
				console.log('--',res);
				this.xiaoqulist1 = res.result.data
				for(let i=0;i<this.xiaoqulist1.length;i++){
					let jishu=0
					for(let j=i+1;j<this.xiaoqulist1.length;j++){
						if(this.xiaoqulist1[i].name==this.xiaoqulist1[j].name){
							jishu=9
							break
						}
					}
					if(jishu==0){
						this.xiaoqulist.push(this.xiaoqulist1[i].name)
					}
				}
			},
			//检测是新增还是修改
			jiance() {
				if (this.ip == 1) {
					this.shu = '修改'
					this.tel = this.infor.id[0].mobile
					this.xiaoqu = this.infor.id[0].xiaoqu
					this.name = this.infor.id[0].name
					this.age = this.infor.id[0].age
					this.zhuzhi = this.infor.id[0].zhuzhi
					this.kecheng = this.infor.kecheng
					this.school = this.infor.id[0].school
					this.nianji = this.infor.id[0].nianji
					this.baomingdate = this.infor.baomingdate
					this.jiezhidate = this.infor.jiezhidate
					this.kechengshu = this.infor.kechengshu
					this.money1 = parseFloat(this.infor.money1)
					this.shoufeifangshi = this.infor.shoufeifangshi
					// this.zhaopian = this.infor.id[0].zhaopian
					// this.shu1 = this.infor.id[0].zhaopian
					this.beizhu=this.infor.beizhu
					this.yihexiaoshu = this.infor.yihexiaoshu
				} else {
					let xsinfo = uni.getStorageSync('aoyashengxueshenginfo')
						this.tel = xsinfo.tel,
						this.name = xsinfo.name,
						this.age = xsinfo.age,
						this.zhuzhi = xsinfo.zhuzhi,
						this.school = xsinfo.school,
						this.kecheng=xsinfo.kecheng,
						this.xiaoqu=xsinfo.xiaoqu,
						this.nianji = xsinfo.nianji,
						this.money1 = xsinfo.money1,
						this.shoufeifangshi = xsinfo.shoufeifangshi,
						this.kechengshu = xsinfo.kechengshu,
						this.yihexiaoshu = xsinfo.yihexiaoshu,
						this.jiezhidate=xsinfo.jiezhidate,
						this.beizhu=xsinfo.beizhu
						console.log('88',this.xiaoqu);
				}
			},
			// 返回时间格式
			getDate(type) {
				const date = new Date();
				let year = date.getFullYear();
				let month = date.getMonth() + 1;
				let day = date.getDate();

				if (type === 'start') {
					year = year - 60;
				} else if (type === 'end') {
					year = year + 2;
				}
				month = month > 9 ? month : '0' + month;
				day = day > 9 ? day : '0' + day;
				return `${year}-${month}-${day}`;
			},
			//报名时间
			bindDateChange: function(e) {
				this.baomingdate = e.detail.value
			},
			//截止日期
			bindDateChange1: function(e) {
				this.jiezhidate = e.detail.value
			},
			// 添加新学生信息到数据库
			tijiao() {
				uni.showLoading({
					title: '加载中……',
					mask: true
				});
				
				// 检查手机号是否正确
				let myreg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
				if (!myreg.test(this.tel)) {
					uni.showToast({
						title: '手机号格式不正确',
						icon: 'none',
						mask: true
					})
					uni.hideLoading()
					return
				}
				if(this.kechengshu<1 || parseInt(this.kechengshu)!=this.kechengshu){
					uni.showToast({
						title: '课程数量必须为正整数！',
						icon: 'none',
						mask: true
					})
					uni.hideLoading()
					return 
				}
				if(parseInt(this.kechengshu)<=parseInt(this.yihexiaoshu)){
					uni.showToast({
						title: '核销的数量需小于课程总数量！',
						icon: 'none',
						mask: true
					})
					uni.hideLoading()
					return 
				}
				//判断手机号是否已存在，存在不能提交新生信息
				if (this.shu2 == 1) {
					uni.showToast({
						title: this.ip == 1 ? '不能修改为系统中已存在的号码' : '手机号码已存在，不能录入新生信息',
						icon: 'none',
						mask: true
					})
					uni.hideLoading()
					return 
				} else {
					// 表格中有没填写的部分,提示一下
					if (this.ip == 1) {
						if (!this.name | !this.age | !this.zhuzhi | !this.school | !this.nianji | !this.baomingdate | !this
							.jiezhidate) {
							return uni.showToast({
								title: '请填写每一个选项',
								icon: 'none',
								mask: true
							})
						}
						this.detail = this.infor.id[0].name + this.infor.id[0].mobile
						if (this.tel !== this.infor.id[0].mobile) {
							this.detail = this.detail + "电话" + this.infor.id[0].mobile + "→" + this.tel + "，"
						}
						if (this.name !== this.infor.id[0].name) {
							this.detail = this.detail + "名字" + this.infor.id[0].name + "→" + this.name + "，"
						}
						if (this.age !== this.infor.id[0].age) {
							this.detail = this.detail + "年龄" + this.infor.id[0].age + "→" + this.age + "，"
						}
						if (this.zhuzhi !== this.infor.id[0].zhuzhi) {
							this.detail = this.detail + "住址" + this.infor.id[0].zhuzhi + "→" + this.zhuzhi + "，"
						}
						if (this.school !== this.infor.id[0].school) {
							this.detail = this.detail + "学校" + this.infor.id[0].school + "→" + this.school + "，"
						}
						if (this.nianji !== this.infor.id[0].nianji) {
							this.detail = this.detail + "年级" + this.infor.id[0].nianji + "→" + this.nianji + "，"
						}
						if (this.baomingdate !== this.infor.baomingdate) {
							this.detail = this.detail + "报名时间" + this.infor.baomingdate + "→" + this.baomingdate + "，"
						}
						if (this.jiezhidate !== this.infor.jiezhidate) {
							this.detail = this.detail + "截止时间" + this.infor.jiezhidate + "→" + this.jiezhidate + "，"
						}
						if (this.yihexiaoshu !== this.infor.yihexiaoshu) {
							this.detail = this.detail + "已核销数" + this.infor.yihexiaoshu + "→" + this.yihexiaoshu + "，"
						}
						if (this.jingshouren !== this.infor.jingshouren) {
							this.detail = this.detail + "经手人" + this.infor.jingshouren + "→" + this.jingshouren + "，"
						}
						if (this.beizhu !== this.infor.beizhu) {
							this.detail = this.detail + "备注" + this.infor.beizhu + "→" + this.beizhu + "，"
						}
						//一、在userinfo中修改个人信息，二、xiugaishuju库中添加一条记录，三、baokelist中更新更改内容
						uniCloud.callFunction({
							name: "funshare",
							data: {
								leixing: 21, 
								_id: this.infor.id[0]._id,
								tel: this.tel,
								xiaoqu: this.xiaoqu,
								name: this.name,
								age: this.age,
								zhuzhi: this.zhuzhi,
								kecheng: this.kecheng,
								school: this.school,
								nianji: this.nianji,
								baomingdate: this.baomingdate,
								jiezhidate: this.jiezhidate,
								kechengshu: parseInt(this.kechengshu),
								// money1: parseInt(this.money1),
								// zhaopian: this.zhaopian,
								yihexiaoshu: parseFloat(this.yihexiaoshu),
								// shoufeifangshi: this.shoufeifangshi,
								jingshouren: this.jingshouren,
								detail: this.detail,
								leibie: '修改学生/课程信息',
								riqi: getDateTime.dateTimeStr('y-m-d h:i:s'),
								baokeid: this.infor._id,
								beizhu:this.beizhu
							}
						}).then(res => {
							uni.hideLoading()
							uni.showToast({
								title: '修改成功',
								icon: 'none',
								duration: 1000
							})
							this.age = this.tel = this.xiaoqu = this.name = this.zhuzhi = this.kecheng = this
								.school =
								this.nianji = this.baomingdate = this.jiezhidate = this.kechengshu = this.money1 =
								this
								.zhaopian = this.yihexiaoshu = this.shoufeifangshi = this.beizhu=''
							uni.navigateTo({
								url: '/pages/xueshenginfor/xueshenginfor'
							});
						})

					} else {
						if(this.iskecheng!==this.kecheng){
							uni.showToast({
								title: '课程必须选择！',
								icon: 'none',
								mask: true
							})
							uni.hideLoading()
							return
						}
						if (!this.xiaoqu | !this.name | !this.age | !this.zhuzhi | !this.kecheng | !this.school | !this
							.nianji | !this.baomingdate | !this.jiezhidate | !this.kechengshu | !this.money1 |
							!this.shoufeifangshi | !this.yihexiaoshu) {
							uni.showToast({
								title: '请填写每一个选项',
								icon: 'none',
								mask: true
							})
							uni.hideLoading()
							return 
						}
						// 一、userinfo库中添加一条信息，
						// 二、zhangwuliushui库中添加一条信息，
						// 三、xiugaishuju库中添加一条信息
						uniCloud.callFunction({ 
							name: "xinhuiyuan", 
							data: {
								leixing: 0,
								name: this.name,
								tel: this.tel,
								role: ["xuesheng"],
								zhaopian: this.zhaopian,
								jingshouren:this.jingshouren,
								zhucedate: getDateTime.dateTimeStr('y-m-d h:i:s'),
								jine: parseInt(this.money1),
								biandong: "收入",
								leibie: "报课程",
								detail: this.name+this.tel + "报课，课程名称：" + this.kecheng +"，课程数量："+ this.kechengshu +"/"+this.yihexiaoshu+ "节",
								age: this.age,
								zhuzhi: this.zhuzhi,
								school: this.school,
								nianji: this.nianji,
								xiaoqu: this.xiaoqu
							}
						}).then(res => {
							let id1 = res.result.id
							// 一、baokelist添加一条数据，
							// 二、xiugaishuju中添加一条数据
							uniCloud.callFunction({
								name: "xinhuiyuan",
								data: {
									leixing: 1, //获取学生ID后，把报课明细写进baokelist
									detail: this.name+this.tel + "报课，课程名称：" + this.kecheng +"，课程数量："+ this.kechengshu +"/"+this.yihexiaoshu+ "节",
									xiaoqu: this.xiaoqu,
									kecheng: this.kecheng,
									jingshouren:this.jingshouren,
									baomingdate: this.baomingdate,
									jiezhidate: this.jiezhidate,
									kechengshu: parseInt(this.kechengshu),
									money1: parseInt(this.money1),
									yihexiaoshu: parseInt(this.yihexiaoshu),
									shoufeifangshi: this.shoufeifangshi,
									id: id1,
									time:getDateTime.dateTimeStr('y-m-d h:i:s'),
									yikefeiyong: parseInt(parseInt(this.money1) / parseInt(this
										.kechengshu) * 100) / 100,
									kechengid: this.kechengid,
									beizhu:this.beizhu
								}
							}).then(res => {
								this.age = this.tel = this.xiaoqu = this.name = this.zhuzhi = this
									.kecheng =
									this.school = this.nianji = this.baomingdate = this.jiezhidate = this
									.kechengshu = this.money1 = this.zhaopian = this.yihexiaoshu = this
									.shoufeifangshi = ''
								uni.removeStorageSync('aoyashengxueshenginfo')
								uni.hideLoading()
							})
							uni.showToast({
								title: '填加成功',
								icon: 'none',
								duration: 3000
							})
						})
					}
				}

			},
			//选择校区
			xiaoquxuanze: function(e) { //选择校区，根据校区选出课程
				this.xiaoqu = this.xiaoqulist[e.detail.value]
			},
			//选择课程
			bindPickerChange: function(e) {
				// 下面是课程的id，一会儿要用
				if (!this.xiaoqu) {
					uni.showToast({
						title: '请先选择校区'
					})
					return
				}
				if (this.ip == 1) {
					uni.showToast({
						title: '不能修改课程'
					})
					return
				}
				this.kechengid = this.kechenglist[e.detail.value]._id
				// console.log(this.kechengid)
				this.iskecheng=this.kecheng = this.kechenglistName[e.detail.value]
			},
		}
	}
</script>

<style>

</style>